import pandas as pd
from  mdir import  readDir;
listdir = readDir("../newbak")
pdir  = []
for l in listdir:
    pdir.append(pd.read_csv(l))
all_data=pd.concat(pdir)
data3=all_data.values[0::,0::]
result1=[]
result2=[]
sum1=0.00
sum2=0.00
for i in range(len(data3)):
    for j in  range(len(data3[0])):
        if(data3[i][j]=='❥┾「My family」'):
            if(data3[i][4]=='收入'):
                result1.append([data3[i][0],data3[i][2],data3[i][1],data3[i][3],data3[i][4],data3[i][5]])
                sum1+=float(data3[i][5].split('¥')[1])
            if(data3[i][4]=='支出'):·
                result2.append([data3[i][0],data3[i][2],data3[i][1],data3[i][3],data3[i][4],data3[i][5]])
                sum2+=float(data3[i][5].split('¥')[1])   
name=['时间','姓名','类型','备注','转入/转出','金额']
test=pd.DataFrame(columns=name,data=result1)
print("收:",sum1)
print("支:",sum2)
print("差:",sum2-sum1)
# test.to_csv('./e.csv',index=False,encoding='utf-8')
